package router

import (
	"github.com/gin-gonic/gin"
	swaggerFiles "github.com/swaggo/files"
	ginSwagger "github.com/swaggo/gin-swagger"

	"lzppp/internal/app/controller"
)

func SetupRouter() *gin.Engine {
	r := gin.Default()

	r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))

	apiV1 := r.Group("/lzppp-api/v1")

	apiV1.GET("/hello", controller.Hello)

	// 用户接口
	userGroup := apiV1.Group("/user")
	{
		userGroup.GET("/list", controller.GetUsers)
		userGroup.GET("/users-name", controller.GetUsersByName)
		userGroup.POST("/create", controller.CreateUser)
	}

	// 文件接口
	fileGroup := apiV1.Group("/file")
	{
		fileGroup.POST("/upload", controller.UploadFileHandler)
		fileGroup.GET("/download", controller.DownloadFileHandler)
		fileGroup.DELETE("/delete", controller.DeleteFileHandler)
		fileGroup.GET("/list", controller.ListFilesHandler)
		fileGroup.GET("/presigned", controller.PresignedURLHandler)
		fileGroup.GET("/download-zip", controller.DownloadZipHandler)
		fileGroup.GET("/folder-size", controller.GetFolderSizeHandler)
		fileGroup.POST("/upload-base64", controller.UploadBase64Handler)
	}

	return r
}
